 package org.code.util;
 
 import java.util.HashMap;
import java.util.Map;
 
 public class AttrTpyeChange
 {
   public static String changeType(String mysqlTpye)
   {
     Map<String, String> mysqlMap = new HashMap<String, String>();
 
     mysqlMap.put("BIGINT", "Long");
     mysqlMap.put("INTEGER", "Integer");
     mysqlMap.put("int", "Short");
     mysqlMap.put("DOUBLE PRECISION", "Double");
     mysqlMap.put("CHARACTER", "Character");
     mysqlMap.put("CHARACTER VARYING", "String");
     mysqlMap.put("LONG VARCHAR", "String");
     mysqlMap.put("DATE", "Date");
     mysqlMap.put("TIMESTAMP", "Date");

     String javaType = (String)mysqlMap.get(mysqlTpye);
 
     return javaType;
   }
 
   public static String exceptBrackets(String mysqlTpye)
   {
     if (mysqlTpye.indexOf("(") != -1) {
       mysqlTpye = mysqlTpye.substring(0, mysqlTpye.indexOf("("));
     }
 
     return mysqlTpye.toLowerCase();
   }
   
    public static String changes(String mysqlTpye){
//    		if (mysqlTpye.indexOf("(") != -1) {
//    	       mysqlTpye = mysqlTpye.substring(0, mysqlTpye.indexOf("("));
//    	     }
    		
    		Map<String, String> mysqlMap = new HashMap<String, String>();
    		 
    	 
    	     mysqlMap.put("INTEGER", "INTEGER");
    	     mysqlMap.put("BIGINT", "bigint");
    	     mysqlMap.put("float", "Float");
    	     mysqlMap.put("DOUBLE PRECISION", "Double");
    	     mysqlMap.put("CHARACTER", "varchar");
    	     mysqlMap.put("CHARACTER VARYING", "varchar");
    	     mysqlMap.put("LONG VARCHAR", "varchar");
    	     mysqlMap.put("blob", "varchar");
    	     mysqlMap.put("DATE", "timestamp");
    	     mysqlMap.put("time", "timestamp");
    	     mysqlMap.put("datetime", "timestamp");
    	     mysqlMap.put("TIMESTAMP", "timestamp");
    	     mysqlMap.put("year", "timestamp");
    	     mysqlMap.put("decimal", "bigint");
    	     mysqlMap.put("longtext", "varchar");
    		
    		return mysqlMap.get(mysqlTpye).toUpperCase();
    }
 }

